﻿using Coater.Base;
using Coater.Dao;
using Coater.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Coater.Config
{
    /// <summary>
    /// 伺服电机配置信息读取处理类
    /// </summary>
    public class ServoCfgHandler : IDeviceConfig
    {
        public string DomainFullName { get; } = typeof(ServoInfo).FullName!;

        /// <inheritdoc />
        public int Order { get; } = 2;

        /// <inheritdoc />
        public ConfigResult<T> LoadConfig<T>() where T : class
        {
            var configResult = new ConfigResult<T>();

            ServoConfigDao ioInfoConfigDao = new ServoConfigDao();
            var infoConfigList = ioInfoConfigDao.GetList().Result;

            configResult.DeviceInfos = infoConfigList as List<T>;
            configResult.Success = true;

            return configResult;
        }
    }
}
